HAL SD macros migration

This section provides information about HAL SD macros for STM32 HAL1 to HAL2 migration.

HAL SD flag/interrupt clearing macros

Note

In both HAL1 and HAL2, flags and interrupts are internally handled by HAL driver within the process functions; normally, application code does not need to check flags or interrupts status directly.

In HAL1, the following macros are used for flag and interrupt management:

  • __HAL_SD_CLEAR_FLAG: Clears the status of any SD flag by passing the desired flag as a parameter.

  • __HAL_SD_CLEAR_IT: Specifically clears the status of SD interrupt flags by passing the appropriate interrupt flag.

In HAL2, the __HAL_SD_CLEAR_IT macro has been removed. Instead, users should use the HAL_SD_ClearFlag() function for all cases (both general flags and interrupt flags) by providing the desired flag as an argument.

HAL1

HAL2

__HAL_SD_CLEAR_FLAG
__HAL_SD_CLEAR_IT

Removed; use __STATIC_INLINE void HAL_SD_ClearFlag(hal_sd_handle_t *hsd, uint32_t flag) instead. Removed; use HAL_SD_ClearFlag() with the appropriate IT mask instead.


HAL SD flag/interrupt status macros

Note

In both HAL1 and HAL2, flags and interrupts are internally handled by HAL driver within the process functions; normally, application code does not need to check flags or interrupts status directly.

In HAL1, the following macros are used for flag and interrupt management:

  • __HAL_SD_GET_FLAG: Retrieves the status of any SD flag by passing the desired flag as a parameter.

  • __HAL_SD_GET_IT: Specifically retrieves the status of SD interrupt flags by passing the appropriate interrupt flag.

In HAL2, the __HAL_SD_GET_IT macro has been removed. Instead, users should use the HAL_SD_IsActiveFlag() function for all cases (both general flags and interrupt flags) by providing the desired flag as an argument.

HAL1

HAL2

__HAL_SD_GET_FLAG
__HAL_SD_GET_IT

Removed; use __STATIC_INLINE uint32_t HAL_SD_IsActiveFlag(const hal_sd_handle_t *hsd, uint32_t flag) instead. Removed; use HAL_SD_IsActiveFlag() with the appropriate IT mask instead.


HAL SD interrupt enable/disable macros

HAL1

HAL2

__HAL_SD_ENABLE_IT
__HAL_SD_DISABLE_IT

Removed; use __STATIC_INLINE void HAL_SD_EnableIT(hal_sd_handle_t *hsd, uint32_t interrupt) instead. Removed; use __STATIC_INLINE void HAL_SD_DisableIT(hal_sd_handle_t *hsd, uint32_t interrupt) instead.


HAL SD reset handle state macro

HAL1

HAL2

__HAL_SD_RESET_HANDLE_STATE
Removed; use HAL_SD_DeInit(hal_sd_handle_t *hsd) instead.

HAL SD enable macro

HAL1

HAL2

__HAL_SD_ENABLE
__HAL_SD_DISABLE
__HAL_SD_DMA_ENABLE
__HAL_SD_DMA_DISABLE

Peripheral enabling/disabling and DMA enabling/disabling are handled internally by the HAL driver.